<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<h:head/>
<h:body>
	<p:commandButton id="editEnactor" value="Edit" onclick="editEnactorDlg.show()"/>

	<p:dialog id="editEnactorDialog" width="600" header="Edit Goal Enactor Selection" widgetVar="editEnactorDlg"  position="center" resizable="true" modal="false" closable="true" appendToBody="">
		<h:form id="form">
		
		<h:panelGrid>
			<p:row>
	        	<p:dataTable var="user" value="#{enactorTable.dataModel}" paginator="true" rows="10" paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}" rowsPerPageTemplate="5,10,15" selectionMode="single" selection="#{enactorTable.selectedUser}" id="enactorTable" lazy="true">  
		      	
		      	<p:ajax event="rowSelect" listener="#{enactorTable.onRowSelect}" update=":form" />  
		      	
		      	<p:column headerText="ID" sortBy="#{user.id}" filterBy="#{user.id}">  
			        <h:outputText value="#{user.id}" />  
			    </p:column>  
		      	
			    <p:column headerText="Username" sortBy="#{user.username}" filterBy="#{user.username}">  
			        <h:outputText value="#{user.username}" />  
			    </p:column>  
		      
			    <p:column headerText="Firstname" sortBy="#{user.firstName}" filterBy="#{user.firstName}">  
			        <h:outputText value="#{user.firstName}" />  
			    </p:column>  
		      
			    <p:column headerText="Lastname" sortBy="#{user.lastName}" filterBy="#{user.lastName}">  
			        <h:outputText value="#{user.lastName}" />  
			    </p:column>  
		       
			    <p:column headerText="Role" sortBy="#{user.role.title}" filterBy="#{user.role.title}">  
			        <h:outputText value="#{user.role.title}" />  
			    </p:column>  
	        	</p:dataTable>  
	        </p:row>
	        <p:row>
	        	<p:column>
					<p:outputLabel>
						Username: 	
					</p:outputLabel>
					
					<p:outputLabel value="#{enactorTable.selectedUser.username}"/>
					
					<p:outputLabel>
						FirstName: 	
					</p:outputLabel>
					
					<p:outputLabel value="#{enactorTable.selectedUser.firstName}"/>
					
					<p:outputLabel>
						LastName: 	
					</p:outputLabel>
					
					<p:outputLabel value="#{enactorTable.selectedUser.lastName}"/>
					
					<p:outputLabel>
						e-mail: 	
					</p:outputLabel>
					
					<p:outputLabel value="#{enactorTable.selectedUser.email}"/>
					
					<p:outputLabel>
						role: 	
					</p:outputLabel>
					
					<p:outputLabel value="#{enactorTable.selectedUser.role.title}"/>
				</p:column>
				<p:column>
					<p:commandButton id="editEnactorCancel" value="Cancel" onclick="editEnactorDlg.hide()"/>
					<p:commandButton id="editEnactorConfirm" value="Confirm" onclick="editEnactorDlg.show()"/>
				</p:column>
	        </p:row>
		</h:panelGrid>
		</h:form>
	</p:dialog>

      <p:dialog header="User Detail" widgetVar="userDetailDlg" resizable="false"  closable="true">  
  
        <h:panelGrid id="userDetailDlg_display" columns="2" cellpadding="4">  
  
            <f:facet name="header">  
                <h:outputText value="#{enactorTable.selectedUser.username}" /> 
            </f:facet>  
	  	<p:row>
			<p:column>
			    	<h:outputText value="Firstname:" />
			</p:column>
			<p:column>		    
				<h:outputText value="#{enactorTable.selectedUser.firstName}" style="font-weight:bold"/>  
	  		</p:column>
		</p:row>
		<p:row>
			<p:column>
		    		<h:outputText value="Lastname:" />  
			</p:column>
			<p:column>	
		    		<h:outputText value="#{enactorTable.selectedUser.lastName}" style="font-weight:bold"/>   
	  		</p:column>
		</p:row>
	  	<p:row>
			<p:column>
		    		<h:outputText value="Email:" />  
			</p:column>
			<p:column>	
		    		<h:outputText value="#{enactorTable.selectedUser.email}" style="font-weight:bold"/>   
	  		</p:column>
		</p:row>
	  	<p:row>
			<p:column>
		   		<h:outputText value="Role Title:" />  
			</p:column>
			<p:column>
		    		<h:outputText value="#{enactorTable.selectedUser.role.title}" style="font-weight:bold"/>  
	  		</p:column>
		</p:row>
		<p:row>
			<p:column> 
				<h:outputText value="Role Description:" />
			</p:column>
		</p:row>
		<p:row>
			<p:column> 
				<h:outputText value="#{enactorTable.selectedUser.role.description}" />
			</p:column>
		</p:row>
	
        </h:panelGrid>  
    </p:dialog>  

</h:body>
</html>
